﻿namespace ExamV5.PaperInfo
{
    using ExamV5;
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmRubricDist : Page
    {
        protected Button butClose;
        protected Button butQuery;
        protected GridView DataGridInfo;
        protected DropDownList DDLDifficulty;
        protected DropDownList DDLSubject;
        protected DropDownList DDLType;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private PublicFun publicFun_0 = new PublicFun();

        protected void butQuery_Click(object sender, EventArgs e)
        {
            this.method_0();
        }

        protected void DataGridInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.DataItemIndex == -1)
            {
                this.DataGridInfo.Attributes.Add("oldValue", "#FFFFFF");
                this.DataGridInfo.Attributes.Add("singleValue", "#FFFFFF");
            }
            else
            {
                e.Row.Attributes.Add("onmouseover", "this.bgColor='#F6F5F5'");
                if ((e.Row.DataItemIndex % 2) != 0)
                {
                    e.Row.Attributes.Add("bgcolor", "#FFFFFF");
                    e.Row.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGridInfo').getAttribute('oldValue')");
                }
                else
                {
                    e.Row.Attributes.Add("bgcolor", "#FFFFFF");
                    e.Row.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGridInfo').getAttribute('singleValue')");
                }
            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[1].Text = this.publicFun_0.GetRubricType(e.Row.Cells[1].Text, "0");
                string str = e.Row.Cells[2].Text.Trim();
                switch (str)
                {
                    case null:
                        return;

                    case "A":
                        e.Row.Cells[2].Text = "难";
                        return;

                    case "B":
                        e.Row.Cells[2].Text = "较难";
                        return;
                }
                if (str != "C")
                {
                    if (!(str == "D"))
                    {
                        if (str == "E")
                        {
                            e.Row.Cells[2].Text = "容易";
                        }
                    }
                    else
                    {
                        e.Row.Cells[2].Text = "较易";
                    }
                }
                else
                {
                    e.Row.Cells[2].Text = "中等";
                }
            }
        }

        private void method_0()
        {
            string strSql = "";
            string str2 = "";
            string str3 = "group by b.SubjectName,a.RubricType";
            if (!(this.DDLDifficulty.SelectedItem.Value == "A"))
            {
                str2 = " a.Difficulty as Difficulty ";
                str3 = str3 + ",Difficulty";
            }
            else
            {
                str2 = " '所有难易' as Difficulty ";
            }
            str3 = str3 + " order by a.RubricType";
            strSql = "select b.SubjectName,Count(*) as CountRubric,RubricType," + str2 + " from RubricInfo a,SubjectInfo b where b.ID=a.SubjectID and a.SubjectID=" + this.DDLSubject.SelectedItem.Value + "  and a.Flag='" + this.DDLType.SelectedItem.Value + "' " + str3;
            this.DataGridInfo.DataSource = this.publicFun_0.RetrunDataView(strSql);
            this.DataGridInfo.DataBind();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamDeptID");
            this.httpCookie_0 = base.Request.Cookies["ExamDeptID"];
            this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
            if (!base.IsPostBack)
            {
                this.publicFun_0.LoadSubjectInfo(this.DDLSubject, "admin", "Y", "B", this.httpCookie_0.Value);
                ListItem item = new ListItem("--请选择所属科目--", "0");
                this.DDLSubject.Items.Insert(0, item);
            }
        }
    }
}

